<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>开始使用 layui</title>
    <link rel="stylesheet" href="./layui-master/dist/css/layui.css">
</head>
<body>

<button class="layui-btn" id="top">上边滑出</button>
<button class="layui-btn" id="bottom">下边滑出</button>
<button class="layui-btn" id="left">左边滑出</button>
<button class="layui-btn" id="right">右边滑出</button>

<script src="./layui-master/dist/layui.js"></script>
<script>
    layui.extend({
        layuiDrawer: './layuiDrawer'
    }).use(['jquery', 'layuiDrawer'], function () {
        var $ = layui.jquery
            , layuiDrawer = layui.layuiDrawer;

        $('#top').click(function () {
            layuiDrawer.render({
                offset: 't',
                top: 30,
                left: 30,
                right: 30,
                height: '300px',
                content: "<div>上边滑出</div>",
            });
        });

        $('#bottom').click(function () {
            layuiDrawer.render({
                offset: 'b',
                bottom: 30,
                left: 30,
                right: 30,
                height: '300px',
                content: "<div>下边滑出</div>",
            });
        });

        $('#left').click(function () {
            layuiDrawer.render({
                offset: 'l',
                left: 30,
                top: 30,
                bottom: 30,
                width: '300px',
                content: "<div>左边滑出</div>",
            });
        });

        $('#right').click(function () {
            layuiDrawer.render({
                offset: 'r',
                right: 30,
                top: 30,
                bottom: 30,
                width: '300px',
                content: "<div>右边滑出</div>",
            });
        });
    });
</script>
</body>
</html>